﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>KaoShi</title>
    <script src="~/Scripts/EasyJS/easyUI/jquery-1.7.2.min.js"></script>
    <style>
        ul {
            list-style: none;
        }
    </style>
</head>
<body>
    <div id="div1">

    </div>
</body>
</html>
<script>
    var _menus

    $.ajax({
        type: "post",
        url: "/TrainRoced/JsonString",
        success: function (obj) {
            // $("body").html(obj);
            //alert(obj);
            obj = JSON.parse(obj);
            //alert(obj);
            _menus = obj;

            var menulist = "";

            $.each(obj.Ti, function (i, n) {

                menulist += '<div style="overflow:auto;">';
                menulist += '<span><span>' + n.ItemProId + '</span>、  ' + n.ItemName + '</span>';
                menulist += '<ul>';
                $.each(n.Ti, function (j, o) {
                    menulist += '<li><div><input id="Radio1" type="radio" value=' + o.ResultId + ' name=' + o.ItemId + ' /><span>' + o.fuhao + '. ' + o.ResultName + '</span></div></li> ';
                })
                menulist += '</ul></div>';
            })
            $("div").html(menulist + '<input id="Button1" type="button" value="提交" onclick="Method()" />');
        }
    })

    var menulist = "";


    function Method() {
        var result = ""
        $("ul li div :radio").each(function () {
            if ($(this).prop("checked"))
                result += $(this).val() + ",";
        })
        result= result.substring(0,result.length-1)
      

        var TiNum = "";
        $("#div1 div span span").each(function () {
            TiNum += $(this).html() + ",";
        })
        TiNum = TiNum.substring(0, TiNum.length - 1)
        $.ajax({
            type: "post",
            url: "/TrainRoced/ExamResult",
            data: { ItemId: TiNum, ResultId: result },
            success: function (obj1) {
                alert("您的考试结果为：" + obj1 + "分！");
                location.href="//"



            }

        })





    }
</script>
